fix: install every lazily-imported dependency in the Colab bootstrap - #168
Merged
Merged
Conversation
The Colab bootstrap installs the stack with `--no-deps`, so any dependency Colab does not itself preinstall must be named in `_SHARED_EXTRAS` or it never lands. `corner==2.2.2` is a base autofit dependency and was absent, so HowToFit chapter 1 tutorial 5 died on Colab with `ModuleNotFoundError: No module named 'corner'` — after the search had already run to completion, in the results update that follows it. It hid because of how it is imported. `corner` is imported inside `corner_cornerpy` rather than at module scope, so `import autofit` succeeds and only the post-fit plot reaches it. Workspace smoke runs at `PYAUTO_TEST_MODE=2` and never constructs the sampler, so no gate has ever executed that line. Rather than add one package and wait for the next report, this audits the whole list: `optax`, `xxhash` and `blackjax` have the same lazy-import shape, and two specifiers had drifted from the pyproject.toml the list claims to track — `anesthetic` was pinned below autofit's own floor, `nautilus-sampler` a patch behind its pin. The new test derives its expectations from PyAutoFit's pyproject.toml rather than restating literals, because restating them is what allowed the drift. Closes #167 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
_SHARED_EXTRASinautonerves/setup_colab.pyis the hand-maintained list of everything the Colab bootstrap installs, because the install runs--no-deps. Four lazily-imported autofit dependencies were missing from it, and two specifiers had drifted from thePyAutoFit/pyproject.tomlthe list's own comment says it tracks.corner==2.2.2corner_cornerpyoptax>=0.2.5MultiStartAdam/MultiStartProdigyxxhash<=3.4.1blackjax>=1.6.2BlackJAXNUTSanesthetic==2.8.14>=2.9.0nautilus-sampler==1.0.4==1.0.5Why it was invisible
corneris imported insidecorner_cornerpy, not at module scope.import autofitsucceeds, the model builds, the search runs to completion, and only the post-fit plot raises. Workspace smoke runs atPYAUTO_TEST_MODE=2, which bypasses the sampler entirely, so no gate has ever executed that import.This is the third report of the same defect —
8336939(#166) closed it for emcee and dynesty. Since each fix needs its own PyPI release to reach a single user, this one audits the whole list instead of adding one package.Tests
test_every_project_installs_every_samplerkeeps its name-only matching and gains the four new packages — it guards the "missing entirely" class.A new
TestSpecifiersTrackAutofitcloses the drift class by deriving expectations from PyAutoFit'spyproject.tomlat run time rather than restating literals, since restating them is precisely what let the drift happen. An exact pin is checked for compatibility with autofit's specifier, so a deliberate narrowing likedill==0.4.0(which satisfies>=0.3.1.1) stands; a range must match exactly, so the list cannot quietly drift from the file. Verified by mutation: reverting either drift makes it fail.Shipping
Merging this does not fix anything on its own — an
autonervesPyPI release is what ships it. The notebook setup cell runspip install autonerves --no-depsunpinned at run time, so a release reaches every already-published notebook retroactively, including tag-pinned ones, with no notebook regeneration.Closes #167
🤖 Generated with Claude Code